﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="LogView.aspx.cs" Inherits="TempEmployees.Web.LogView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div style="direction: ltr">
                <asp:Panel ID="FiltersPanel" runat="server" DefaultButton="FilterButton">
                    <table>
                        <tr>
                            <td>
                                SessionID
                            </td>
                            <td>
                                Severity
                            </td>
                            <td>
                                Date
                            </td>
                            <td>
                                Caller
                            </td>
                            <td>
                                Message
                            </td>
                            <td>
                                User ID
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox ID="SessionIDTextBox" runat="server" OnTextChanged="SetFilters_Event"></asp:TextBox>
                            </td>
                            <td>
                                <asp:DropDownList ID="SeverityDropDown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="SetFilters_Event">
                                    <asp:ListItem Text="All" Value="0" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="Debug" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Info" Value="2"></asp:ListItem>
                                    <asp:ListItem Text="Error" Value="4"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:DropDownList ID="DateDropDown" runat="server" AutoPostBack="true" OnSelectedIndexChanged="SetFilters_Event">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:TextBox ID="CallerTextBox" runat="server" OnTextChanged="SetFilters_Event"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="MessageTextBox" runat="server" OnTextChanged="SetFilters_Event"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox ID="UserIDTextBox" runat="server" OnTextChanged="SetFilters_Event"></asp:TextBox>
                            </td>
                            <td>
                                <asp:Button ID="FilterButton" runat="server" OnClick="SetFilters_Event" Text="Filter" />
                                <asp:Button ID="ClearButton" runat="server" Text="Clear" OnClick="ClearButton_Click" />
                                <asp:Button ID="ExportToExcel" runat="server" Text="Export to excel" OnClick="ExportToExcel_Click" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <br />
                <asp:Panel ID="LogDisplayPanel" runat="server">
                    <asp:GridView ID="LogGridView" runat="server" AllowPaging="True" AllowSorting="True"
                        AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="LogDataSource">
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                                SortExpression="ID" />
                            <asp:BoundField DataField="SessionID" HeaderText="SessionID" SortExpression="SessionID" />
                            <asp:BoundField DataField="Severity" HeaderText="Severity" SortExpression="Severity"
                                Visible="false" />
                            <asp:BoundField DataField="SeverityName" HeaderText="Severity" SortExpression="Severity"
                                ReadOnly="True" />
                            <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                            <asp:BoundField DataField="Caller" HeaderText="Caller" SortExpression="Caller" />
                            <asp:BoundField DataField="Message" HeaderText="Message" SortExpression="Message" />
                            <asp:BoundField DataField="UserID" HeaderText="User ID" SortExpression="UserID" />
                        </Columns>
                    </asp:GridView>
                    <asp:LinqDataSource ID="LogDataSource" runat="server" ContextTypeName="TempEmployees.DAL.EmpDatabaseDataContext"
                        EntityTypeName="" OnSelecting="LogDataSource_Selecting" OrderBy="Date desc" TableName="LogEntries">
                    </asp:LinqDataSource>
                </asp:Panel>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="ExportToExcel" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
